home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / UserTermination.h < prev    next >
Encoding:
Text File  |  1993-01-14  |  2.6 KB  |  95 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Programmer: Kent Sandvik
  5.   Date: 9/26/92
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TUserTermination is a command dot tracking class, used for finding out if the end user wants to stop
  9.   an action. Most of the code is based on earlier snippet by Dave Radcliffe/DTS.
  10.   TUserTermination.h contains the header file information for the TUserTermination class.
  11.   _________________________________________________________________________________________________________ */
  12.  
  13. // Declare label for this header file
  14. #ifndef _USERTERMINATION_
  15. #define _USERTERMINATION_
  16.  
  17. #ifndef _DTSCPLUSLIBRARY_
  18. #include "DTSCPlusLibrary.h"
  19. #endif
  20.  
  21. #ifndef __SCRIPT__
  22. #include <Script.h>
  23. #endif
  24.  
  25. #ifndef __EVENTS__
  26. #include <Events.h>
  27. #endif
  28.  
  29. #ifndef __RESOURCES__
  30. #include <Resources.h>
  31. #endif
  32.  
  33. #ifndef __OSEVENTS__
  34. #include <OSEvents.h>
  35. #endif
  36.  
  37. #ifndef __GESTALTEQU__
  38. #include <GestaltEqu.h>
  39. #endif
  40.  
  41.  
  42. // Inline definitions
  43. pascal long AUXDispatch(short selector,
  44.                         char* p) = {
  45.                                     0xABF9};
  46.  
  47.  
  48. // _________________________________________________________________________________________________________ //
  49. //    Class Interface
  50.  
  51. class TUserTermination
  52. // TUserTermination is a simple event checking class, that tries to find out when the end user
  53. // has pressed a '.' and a command key, or another combination reminding of a termination
  54. // (such as command-q, even if command-. is the official Apple User Interface way of doing things.
  55. {
  56. public:
  57.     //    ENUMS AND TYPEDEFS
  58.     enum EConstant
  59.     {
  60.         kAUXFindEvent = 8, ktAscii2Mask = 0x000000FF, ktAscii1Mask = 0x00FF0000
  61.     };
  62.  
  63.     //    CONSTRUCTORS AND DESTRUCTORS
  64.     TUserTermination(char ASCIIValue = '.');    // Note dot ('.') as the default ascii char
  65.     virtual~ TUserTermination();
  66.  
  67.     //    INITIALIZATION ROUTINES    
  68.     virtual void Initialize();
  69.  
  70.     //    MAIN INTERFACE
  71.     virtual Boolean Abort();                    // main function
  72.  
  73.     //    PRIVATE INTERNAL FUNCTIONS
  74.     virtual Boolean CheckAUXEventQueue(char keyCode,
  75.                                        short modifiers);
  76.     //    FIELDS
  77. protected:
  78.     char fChar;                                    // our initial key value
  79.     char fKeyCode;                                // the key value translated to a virtual code char
  80.     Boolean fAUX;                                // do we run under A/UX or not (different event handling)
  81. };
  82.  
  83. #endif
  84.  
  85. // _________________________________________________________________________________________________________ //
  86.  
  87.  
  88. /*    Change History (most recent last):
  89.   No        Init.    Date        Comment
  90.   1            khs        9/26/92        New file
  91. */
  92.  
  93.  
  94.  
  95.